﻿using Application.DTO;
using AutoMapper;
using Core;
using Core.IPepositories;
using System;
using System.Collections.Generic;

namespace Application
{
    public class UserService : IUserService
    {
        private readonly IUserRepository _repository;
        private readonly IMapper _mapper;
        private readonly IUnitOfWork _unitOfWork;

        public UserService(IUserRepository repository, IUnitOfWork unitOfWork, IMapper mapper)
        {
            _repository = repository;
            _mapper = mapper;
            _unitOfWork = unitOfWork;
        }

        public List<UserInfo> GetAllUser()
        {
            return _mapper.Map<List<UserInfo>>(_repository.GetAllUser());
        }

        public UserInfo GetUserInfo(Guid userID)
        {
            return _mapper.Map<UserInfo>(_repository.GetUserInfo(userID));
        }

        UserLoginDTO IUserService.CheckUser(string name, string password)
        {
            return _mapper.Map<UserLoginDTO>(_repository.CheckUser(name, password));
        }
    }
}
